package com.tianji.StragyHttp.controller;

import com.tianji.StragyHttp.dto.BaseCustomerAnalysisDTO;
import com.tianji.StragyHttp.service.ICustomerInsightService;
import com.tianji.common.Result;
import com.tianji.coupon.enums.Code;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;


@RestController
@RequestMapping("/customer-insight")
@Slf4j
public class CustomerInsightController {
    @Resource
    private ICustomerInsightService customerInsightService;

    @GetMapping("/customer-analysis-data")
    @ApiOperation(value = "查询数据通用接口", notes = "查询数据通用接口", httpMethod = "GET")
    public <T> Result<T> getCustomerAnalysisData(@RequestBody @Valid BaseCustomerAnalysisDTO dto) {
        //这里可以提前组装dto信息：todo
        return new Result<>(customerInsightService.getCustomerAnalysisData(dto),"查询成功");
    }

    @PostMapping("/customer-analysis-data/export")
    @ApiOperation(value = "导出数据通用接口", notes = "导出数据通用接口", httpMethod = "POST")
    public Result<Boolean> exportCustomerAnalysisData(@RequestBody @Valid BaseCustomerAnalysisDTO dto) {
        return new Result<>(Code.ReqSuccess,"导出成功",customerInsightService.exportCustomerAnalysisData(dto));
    }

}
